<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <bytton style=" height:100px;color:red" title="提示文本" onclick="add()">点击</bytton>
    <div title="提示文本" style="height:100px; color:red">
        这是div
    </div>
    <script>
        function add() {
            console.log("add");
        }
        var div = document.querySelector("div");

        div.onclick = function () {
            console.log("-----------------");
        }
    </script>

</body>

</html>